package liangtWorkSpace.strategy.comparatorFile;

import liangtWorkSpace.strategy.comparableFile.Cat;

import java.util.Arrays;

/**
 * @ClassName SorterMain
 * @Description : 功能说明
 * @Author : LiangT
 * @Date : 2020/4/10 18:34
 */
public class SorterMain {

    public static void main(String[] args) {
//        Dog[] dogs = {new Dog(1),new Dog(7),new Dog(5)};
//        Soter<Dog> dogSoter = new Soter<>();
//        dogSoter.sort(dogs,new DogCpmparator());
//        System.out.println(Arrays.toString(dogs));
//
        Cat[] cats = {new Cat(1, 8), new Cat(5, 5), new Cat(2, 9)};
        Soter<Cat> dogSoter = new Soter<>();
        dogSoter.sort(cats, new CatHeightCpmparator());
        System.out.println("按照身高排序："+Arrays.toString(cats));
        dogSoter.sort(cats, new CatWeightCpmparator());
        System.out.println("那种体重排序："+Arrays.toString(cats));
        dogSoter.sort(cats, (o1,o2)->{
            if (o1.height < o2.height) return -1;
            else if (o1.height > o2.height) return 1;
            else return 0;
        });
    }
}
